import {Attorney} from "../../models/attorney";
import {convertToPinyin} from "../../util/ConvertToPinyin";
import {config} from "../../config/config";

Page({
  data: {
    lawyerObj: {
      eName: '',
      expertise: []
    },
    showLoading: true
  },
  async onLoad(options) {
    await this.getEliteDetailInfo(options.id)
  },
  async getEliteDetailInfo(id) {
    const res = await Attorney.doApiGetAttorneyDetail(id)
    this.setData({
      lawyerObj: res.data,
      "lawyerObj.portrait": config.apiBaseUrl + res.data.profilephoto,
      "lawyerObj.expertise": res.data.specialty.split('-'),
      "lawyerObj.eName": convertToPinyin(res.data.name),
      showLoading: false
    })
  }
})
